<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<div id="vue">
    <todo>
        <todo-title slot="todo-title" title="今日动漫推荐"></todo-title>
        <todo-items slot="todo-items" v-for="(item, index) in todoItems" v-bind:item="item" v-bind:index="index" :key="index"></todo-items>
    </todo>
</div>
<!--引入Vue-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>

<script type="text/javascript">


    /*定义一个todo的代办事件项组件*/
    Vue.component('todo', {
        template: '<div>\
                    <slot name="todo-title"></slot>\
                    <ul>\
                        <slot name="todo-items"></slot>\
                    </ul>\
               </div>'
    });

    Vue.component('todo-title',{
       props: ['title'],
       template: '<div>{{title}}</div>'
    });


    Vue.component('todo-items',{
       props: ['item','index'],
       template: '<li>{{index+1}}.{{item}}</li>'
    });

    var vm = new Vue({
        el: '#vue',
        data: {
            todoItems: ['《刀剑神域3》', '《关于我转生成为史莱姆这件事》', '《实力至上主义教室》']
        }
    });

</script>


</body>
</html>